﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using yiCommerce.Core;
using yiCommerce.Models.Statuses;
using yiCommerce.Service.Statuses;

namespace yiCommerce.Controllers.api
{


    public class HomeLineResult
    {
        public IList<StatusListItemModel> StatusList { get; set; }

        public string Status { get; set; }
    }

    public class HomeLineRequest
    {
        public int CustomerId { get; set; }

        public int PageSize { get; set; }

        public int PageIndex { get; set; }
    }

    public class StatusApiController : ApiController
    {
        private IStatusService _statusService;
        private IWorkContext _workContext;

        public StatusApiController(IStatusService statusService, IWorkContext workContext)
        {
            _statusService = statusService;
            _workContext = workContext;
        }

        [HttpPost]
        public HomeLineResult HomeLine(HomeLineRequest request)
        {
            var result = new HomeLineResult();
            var statuses = _statusService.HomeTimeLine(request.CustomerId, request.PageIndex, request.PageSize);
            var statusList = Mapper.StatusMapper.PrepareStatusListItemModel(statuses);
            result.StatusList = statusList;
            result.Status = "0";
            return result;

        }



    }
}
